Commit 8b12045b authored by David Price's avatar David Price

Trying to get NFAPI working. BCH not being sent out over the air but is being scheduled

parent 0fccd994
......@@ -28,6 +28,7 @@ cmake_minimum_required (VERSION 2.8)
################################################
set (OPENAIR_DIR $ENV{OPENAIR_DIR})
set (NFAPI_DIR $ENV{NFAPI_DIR})
set (NFAPI_USER_DIR ${OPENAIR_DIR}/nfapi)
set (OPENAIR1_DIR ${OPENAIR_DIR}/openair1)
set (OPENAIR2_DIR ${OPENAIR_DIR}/openair2)
set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3)
......@@ -738,7 +739,12 @@ else()
include_directories("${OPENAIR2_DIR}/UTIL")
include_directories("${OPENAIR2_DIR}/UTIL/LOG")
endif()
include_directories("${NFAPI_DIR}")
include_directories("${NFAPI_DIR}/nfapi/public_inc")
include_directories("${NFAPI_DIR}/common/public_inc")
include_directories("${NFAPI_DIR}/pnf/public_inc")
include_directories("${NFAPI_DIR}/nfapi/inc")
include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
include_directories("${OPENAIR1_DIR}")
include_directories("${OPENAIR2_DIR}/NAS")
include_directories("${OPENAIR2_DIR}")
......@@ -980,6 +986,58 @@ set(SCHED_SRC
)
add_library(SCHED_LIB ${SCHED_SRC})
# nFAPI
#################################
set(NFAPI_COMMON_SRC
${NFAPI_DIR}/common/src/debug.c
)
add_library(NFAPI_COMMON_LIB ${NFAPI_COMMON_SRC})
include_directories(${NFAPI_DIR}/common/public_inc)
set(NFAPI_SRC
${NFAPI_DIR}/nfapi/src/nfapi.c
${NFAPI_DIR}/nfapi/src/nfapi_p4.c
${NFAPI_DIR}/nfapi/src/nfapi_p5.c
${NFAPI_DIR}/nfapi/src/nfapi_p7.c
)
add_library(NFAPI_LIB ${NFAPI_SRC})
include_directories(${NFAPI_DIR}/nfapi/public_inc)
include_directories(${NFAPI_DIR}/nfapi/inc)
set(NFAPI_PNF_SRC
${NFAPI_DIR}/pnf/src/pnf.c
${NFAPI_DIR}/pnf/src/pnf_interface.c
${NFAPI_DIR}/pnf/src/pnf_p7.c
${NFAPI_DIR}/pnf/src/pnf_p7_interface.c
)
add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC})
include_directories(${NFAPI_DIR}/pnf/public_inc)
include_directories(${NFAPI_DIR}/pnf/inc)
set(NFAPI_VNF_SRC
${NFAPI_DIR}/vnf/src/vnf.c
${NFAPI_DIR}/vnf/src/vnf_interface.c
${NFAPI_DIR}/vnf/src/vnf_p7.c
${NFAPI_DIR}/vnf/src/vnf_p7_interface.c
)
add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC})
include_directories(${NFAPI_DIR}/vnf/public_inc)
include_directories(${NFAPI_DIR}/vnf/inc)
# nFAPI user defined code
#############################
set(NFAPI_USER_SRC
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/nfapi_pnf.c
${NFAPI_USER_DIR}/nfapi_vnf.c
)
add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
set(PHY_SRC
......@@ -1175,6 +1233,8 @@ add_library(L2
${ENB_APP_SRC})
# ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
include_directories(${NFAPI_USER_DIR})
if (FLEXRAN_AGENT_SB_IF)
#Test for adding a shared library
......@@ -1588,6 +1648,13 @@ add_library(OPENAIR0_LIB
${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
)
include_directories("${NFAPI_DIR}/nfapi/public_inc")
include_directories("${NFAPI_DIR}/common/public_inc")
include_directories("${NFAPI_DIR}/pnf/public_inc")
include_directories("${NFAPI_DIR}/nfapi/inc")
include_directories("${NFAPI_DIR}/sim_common/inc")
include_directories("${NFAPI_DIR}/pnf_sim/inc")
# System packages that are required
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
# or cmake provide a generic interface to pkg-config that widely used
......@@ -1643,6 +1710,26 @@ endif()
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
#pkg_search_module(NFAPI nfapi)
#if(NOT ${NFAPI_FOUND})
#message( FATAL_ERROR "PACKAGE nfapi not found: some targets will fail. Run build_oai -I again!")
#else()
#include_directories(${NFAPI_INCLUDE_DIRS})
#message( "PACKAGE nfapi!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
#message( "${NFAPI_INCLUDE_DIR}")
#message( "${NFAPI_COMMON_INCLUDE_DIR}")
#message( "${NFAPI_VNF_INCLUDE_DIR}")
#message( "${NFAPI_PNF_INCLUDE_DIR}")
#message( "XXX")
#message( "${NFAPI_LIBRARY}")
#message( "${NFAPI_COMMON_LIBRARY}")
#message( "${NFAPI_PNF_LIBRARY}")
#message( "XXX")
#message( "${NFAPI_LIBRARIES}")
#message( "XXX")
#endif()
pkg_search_module(XPM xpm)
if(NOT ${XPM_FOUND})
message("PACKAGE xpm not found: some targets will fail")
......@@ -1682,6 +1769,12 @@ if (${T_TRACER})
set (T_LIB "rt")
endif (${T_TRACER})
#if (${NFAPI_DIR})
#set (NFAPI_PNF_LIB "nfapi_pnf")
#set (NFAPI_LIB "nfapi")
#set (NFAPI_COMMON_LIB "nfapi_common")
#endif (${NFAPI_DIR})
#
#Some files in the T directory are generated.
#This rule and the following deal with it.
add_custom_command (
......@@ -1740,6 +1833,9 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem -ldl
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
z
-Wl,--end-group )
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
......@@ -1858,22 +1954,44 @@ add_executable(oaisim
${T_SOURCE}
)
#add_library( imp_nfapi STATIC IMPORTED)
#set_property(TARGET imp_nfapi PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/libnfapi.a)
#set_property(TARGET imp_nfapi PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/libnfapi.a)
#target_link_libraries(oaisim imp_nfapi)
#add_library( imp_nfapi_common STATIC IMPORTED)
#set_property(TARGET imp_nfapi_common PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/common/libnfapi_common.a)
#set_property(TARGET imp_nfapi_common PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/common/libnfapi_common.a)
#target_link_libraries(oaisim imp_nfapi_common)
#add_library( imp_nfapi_pnf STATIC IMPORTED)
#set_property(TARGET imp_nfapi_pnf PROPERTY IMPORTED_LOCATION ${NFAPI_DIR}/pnf/libnfapi_pnf.a)
#set_property(TARGET imp_nfapi_pnf PROPERTY IMPORTED_IMPLIB ${NFAPI_DIR}/pnf/libnfapi_pnf.a)
#target_link_libraries(oaisim imp_nfapi_pnf)
#
#add_library (imp_nfapi_common STATIC IMPORTED)
#set_target_properties(imp_nfapi_common PROPERTIES IMPORTED_LOCATION ${NFAPI_DIR}/common/libnfapi_common.a
#set_target_properties(oaisim PROPERTIES LINK_FLAGS ${NFAPI_DIR}/nfapi/libnfapi.a ${NFAPI_DIR}/pnf/libnfapi_pnf.a ${NFAPI_DIR}/common/libnfapi_common.a)
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
-Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB}
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB
-Wl,--end-group )
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} )
#Force link with forms, regardless XFORMS option
target_link_libraries (oaisim forms)
target_link_libraries (oaisim ${T_LIB})
# A all in one network simulator
################
add_executable(oaisim_nos1
......
......@@ -187,7 +187,7 @@ function main() {
GDB=1
CMAKE_BUILD_TYPE="Debug"
echo_info "Will Compile with gdb symbols and disable compiler optimization"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug"
CMAKE_CMD="$CMAKE_CMD -DCMAKE_BUILD_TYPE=Debug --trace-expand"
shift;;
--eNB)
eNB=1
......
......@@ -205,6 +205,7 @@ install_protobuf_c_from_source(){
rm -rf /tmp/protobuf-c
git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
git checkout 2a46af42784abf86804d536f6e0122d47cfeea45
./autogen.sh
./configure
echo "Compiling protobuf-c"
......
//#include "fapi_stub.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#if 0
#if 0
//DJP
#include <mutex>
#include <queue>
#include <list>
#endif
//DJP struct phy_pdu
typedef struct
{
#if 0
phy_pdu() : buffer_len(1500), buffer(0), len(0)
{
buffer = (char*) malloc(buffer_len);
}
virtual ~phy_pdu()
{
free(buffer);
}
#endif
unsigned buffer_len;
char* buffer;
unsigned len;
} phy_pdu;
// DJP class fapi_private
typedef struct
{
//std::mutex mutex;
//std::queue<phy_pdu*> rx_buffer;
//std::queue<phy_pdu*> free_store;
#if 0
public:
fapi_private()
: byte_count(0), tick(0), first_dl_config(false)
{
}
phy_pdu* allocate_phy_pdu()
{
phy_pdu* pdu = 0;
mutex.lock();
if(free_store.empty())
{
pdu = new phy_pdu();
}
else
{
pdu = free_store.front();
free_store.pop();
}
mutex.unlock();
return pdu;
}
void release_phy_pdu(phy_pdu* pdu)
{
mutex.lock();
free_store.push(pdu);
mutex.unlock();
}
bool rx_buffer_empty()
{
bool empty;
mutex.lock();
empty = rx_buffer.empty();
mutex.unlock();
return empty;
}
void push_rx_buffer(phy_pdu* buff)
{
mutex.lock();
rx_buffer.push(buff);
mutex.unlock();
}
phy_pdu* pop_rx_buffer()
{
phy_pdu* buff = 0;
mutex.lock();
if(!rx_buffer.empty())
{
buff = rx_buffer.front();
rx_buffer.pop();
}
mutex.unlock();
return buff;
}
#endif
uint32_t byte_count;
uint32_t tick;
uint8_t first_dl_config;
} fapi_private ;
#if defined(__cplusplus)
extern "C"
{
#endif
typedef struct fapi_internal
{
fapi_t _public;
fapi_cb_t callbacks;
uint8_t state;
fapi_config_t config;
int rx_sock;
int tx_sock;
struct sockaddr_in tx_addr;
uint32_t tx_byte_count;
uint32_t tick;
fapi_private* fapi;
} fapi_internal_t;
#if defined(__cplusplus)
}
#endif
#if 0
//DJP
void send_uplink_indications(fapi_internal_t* instance, uint16_t sfn_sf)
{
fapi_harq_ind_t harq_ind;
(instance->callbacks.fapi_harq_ind)(&(instance->_public), &harq_ind);
fapi_crc_ind_t crc_ind;
crc_ind.header.message_id = FAPI_CRC_INDICATION;
crc_ind.header.length = 0; //??;
crc_ind.sfn_sf = sfn_sf;
crc_ind.body.number_of_crcs = 1;
crc_ind.body.pdus[0].rx_ue_info.handle = 0; //??
crc_ind.body.pdus[0].rx_ue_info.rnti = 0; //??
crc_ind.body.pdus[0].rel8_pdu.crc_flag = 1;
(instance->callbacks.fapi_crc_ind)(&(instance->_public), &crc_ind);
if(!instance->fapi->rx_buffer_empty())
{
fapi_rx_ulsch_ind_t rx_ind;
memset(&rx_ind, 0, sizeof(rx_ind));
rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
rx_ind.sfn_sf = sfn_sf;
phy_pdu* buff = 0;
int i = 0;
std::list<phy_pdu*> free_list;
do
{
buff = instance->fapi->pop_rx_buffer();
if(buff != 0)
{
if(buff->len == 0)
{
printf("[FAPI] Buffer length = 0\n");
}
rx_ind.body.pdus[i].rx_ue_info.handle = 0xDEADBEEF;
rx_ind.body.pdus[i].rx_ue_info.rnti = 0x4242;
rx_ind.body.pdus[i].rel8_pdu.length = buff->len;
//rx_ind.pdus[i].rel8_pdu.data_offset;
//rx_ind.pdus[i].rel8_pdu.ul_cqi;
//rx_ind.pdus[i].rel8_pdu.timing_advance;
rx_ind.body.data[i] = buff->buffer;
rx_ind.body.number_of_pdus++;
i++;
instance->fapi->byte_count += buff->len;
free_list.push_back(buff);
}
}while(buff != 0 && i < 8);
(instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
for(phy_pdu* pdu : free_list)
{
instance->fapi->release_phy_pdu(pdu);
//free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data);
}
}
else
{
fapi_rx_ulsch_ind_t rx_ind;
memset(&rx_ind, 0, sizeof(rx_ind));
rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION;
rx_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind);
}
fapi_rx_cqi_ind_t cqi_ind;
cqi_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_rx_cqi_ind)(&(instance->_public), &cqi_ind);
fapi_rx_sr_ind_t sr_ind;
sr_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_rx_sr_ind)(&(instance->_public), &sr_ind);
fapi_rach_ind_t rach_ind;
rach_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_rach_ind)(&(instance->_public), &rach_ind);
fapi_srs_ind_t srs_ind;
srs_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_srs_ind)(&(instance->_public), &srs_ind);
/*
nfapi_lbt_dl_indication_t lbt_ind;
memset(&lbt_ind, 0, sizeof(lbt_ind));
lbt_ind.header.message_id = NFAPI_LBT_DL_INDICATION;
lbt_ind.header.phy_id = config->phy_id;
lbt_ind.sfn_sf = sfn_sf;
nfapi_pnf_p7_lbt_dl_ind(config, &lbt_ind);
vendor_ext_p7_ind ve_p7_ind;
memset(&ve_p7_ind, 0, sizeof(ve_p7_ind));
ve_p7_ind.header.message_id = P7_VENDOR_EXT_IND;
ve_p7_ind.header.phy_id = config->phy_id;
ve_p7_ind.error_code = NFAPI_MSG_OK;
nfapi_pnf_p7_vendor_extension(config, &(ve_p7_ind.header));
*/
fapi_nb_harq_ind_t nb_harq_ind;
nb_harq_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_nb_harq_ind)(&(instance->_public), &nb_harq_ind);
fapi_nrach_ind_t nrach_ind;
nrach_ind.sfn_sf = sfn_sf;
(instance->callbacks.fapi_nrach_ind)(&(instance->_public), &nrach_ind);
}
#endif
#if 0
void* fapi_thread_start(void* ptr)
{
set_thread_priority(81);
fapi_internal_t* instance = (fapi_internal_t*)ptr;
uint16_t sfn_sf_dec = 0;
uint32_t last_tv_usec = 0;
uint32_t last_tv_sec = 0;
uint32_t millisec;
uint32_t last_millisec = -1;
uint16_t catchup = 0;
while(1)
{
// get the time
struct timeval sf_start;
(void)gettimeofday(&sf_start, NULL);
uint16_t sfn_sf = ((((sfn_sf_dec) / 10) << 4) | (((sfn_sf_dec) - (((sfn_sf_dec) / 10) * 10)) & 0xF));
// increment the sfn/sf - for the next subframe
sfn_sf_dec++;
if(sfn_sf_dec > 10239)
sfn_sf_dec = 0;
fapi_subframe_ind_t ind;
ind.sfn_sf = sfn_sf;
if(instance->fapi->first_dl_config)
{
//DJP send_uplink_indications(instance, sfn_sf);
}
if(instance->tick == 1000)
{
if(instance->tx_byte_count > 0)
{
printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
instance->tx_byte_count = 0;
}
instance->tick = 0;
}
instance->tick++;
(instance->callbacks.fapi_subframe_ind)(&(instance->_public), &ind);
{
//DJP phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
phy_pdu* pdu = (phy_pdu*)malloc(sizeof(phy_pdu));
int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, MSG_DONTWAIT, 0, 0);
if(len > 0)
{
pdu->len = len;
//DJP instance->fapi->push_rx_buffer(pdu);
}
else
{
//DJP instance->fapi->release_phy_pdu(pdu);
}
}
if(catchup)
{
catchup--;
}
else
{
struct timespec now_ts;
struct timespec sleep_ts;
struct timespec sleep_rem_ts;
// get the current time
clock_gettime(CLOCK_MONOTONIC, &now_ts);
// determine how long to sleep before the start of the next 1ms
sleep_ts.tv_sec = 0;
sleep_ts.tv_nsec = 1e6 - (now_ts.tv_nsec % 1000000);
int nanosleep_result = nanosleep(&sleep_ts, &sleep_rem_ts);
if(nanosleep_result != 0)
printf("*** nanosleep failed or was interrupted\n");
clock_gettime(CLOCK_MONOTONIC, &now_ts);
millisec = now_ts.tv_nsec / 1e6;
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec)
{
printf("*** missing millisec %d %d\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
last_millisec = millisec;
}
}
}
#endif
#if defined(__cplusplus)
extern "C" {
#endif
#if 0
fapi_t* fapi_create(fapi_cb_t* callbacks, fapi_config_t* config)
{
fapi_internal_t* instance = (fapi_internal_t*)calloc(1, sizeof(fapi_internal_t));
instance->callbacks = *callbacks;
instance->config = *config;
instance->state = 0;
// DJP instance->fapi = new fapi_private();
instance->fapi = (fapi_t*)malloc(sizeof(fapi_private));
return (fapi_t*)instance;
}
#endif
#if 0
void fapi_destroy(fapi_t* fapi)
{
fapi_internal_t* instance = (fapi_internal_t*)fapi;
//DJP delete instance->fapi;
free(instance);
}
#endif
#if 0
void* fapi_rx_thread_start(void* ptr)
{
set_thread_priority(60);
fapi_internal_t* instance = (fapi_internal_t*)ptr;
while(1)
{
//DJP phy_pdu* pdu = instance->fapi->allocate_phy_pdu();
phy_pdu* pdu = (phy_pdu*)malloc(sizeof(phy_pdu));
int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0);
if(len > 0)
{
pdu->len = len;
//instance->fapi->push_rx_buffer(pdu);
}
else
{
//instance->fapi->release_phy_pdu(pdu);
}
}
}
#endif
#if 0
void fapi_start_data(fapi_t* fapi, unsigned rx_port, const char* tx_address, unsigned tx_port)
{
fapi_internal_t* instance = (fapi_internal_t*)fapi;
printf("[FAPI] Rx Data from %d\n", rx_port);
printf("[FAPI] Tx Data to %s:%d\n", tx_address, tx_port);
instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0);
if(instance->rx_sock < 0)
{
printf("[FAPI] Failed to create socket\n");
return;
}
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(rx_port);
addr.sin_addr.s_addr = INADDR_ANY;
int bind_result = bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
if(bind_result == -1)
{
printf("[FAPI] Failed to bind to port %d\n", rx_port);
close(instance->rx_sock);
return ;
}
instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0);
instance->tx_addr.sin_family = AF_INET;
instance->tx_addr.sin_port = htons(tx_port);
instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address);
}
#endif
void fill_tlv(fapi_tlv_t tlvs[], uint8_t count, uint8_t tag, uint8_t len, uint16_t value)
{
tlvs[count].tag = tag;
tlvs[count].value = value;
tlvs[count].length = len;
}
#if 0
int fapi_param_request(fapi_t* fapi, fapi_param_req_t* req)
{
fapi_internal_t* instance = (fapi_internal_t*)fapi;
fapi_param_resp_t resp;
resp.header.message_id = FAPI_PARAM_RESPONSE;
resp.error_code = FAPI_MSG_OK;
resp.number_of_tlvs = 0;
fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_STATE_TAG, 2, instance->state);
#if 0
//DJP
if(instance->state == 0)
{
if(instance->config.duplex_mode == 0)
{
// -- TDD
// Downlink Bandwidth Support
// Uplink Bandwidth Support
// Downlink Modulation Support
// Uplink Modulation Support
// PHY Antenna Capability
// Release Capability
// MBSFN Capability
}
else if(instance->config.duplex_mode == 1)
{
// -- FDD
// Downlink Bandwidth Support
fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.dl_channel_bw_support);
// Uplink Bandwidth Support
fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.ul_channel_bw_support);
// Downlink Modulation Support
// Uplink Modulation Support
// PHY Antenna Capability
// Release Capability
// MBSFN Capability
// LAA Capability
}
}
else
{
if(instance->config.duplex_mode == 0)
{
// -- TDD
// Downlink Bandwidth Support
// Uplink Bandwidth Support
// Downlink Modulation Support
// Uplink Modulation Support
// PHY Antenna Capability
// Release Capability
// MBSFN Capability
// Duplexing Mode
// PCFICH Power Offset
// P-B
// DL Cyclic Prefix Type
// UL Cyclic Prefix Type
// RF Config
// PHICH Config
// SCH Config
// PRACH Config
// PUSCH Config
// PUCCH Config
// SRS Config
// Uplink Reference Signal Config
// TDD Frame Structure Config
// Data Report Mode
}
else if(instance->config.duplex_mode == 1)
{
// FDD
// Downlink Bandwidth Support
// Uplink Bandwidth Support
// Downlink Modulation Support
// Uplink Modulation Support
// PHY Antenna Capability
// Release Capability
// MBSFN Capability