diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 108c45779e552fd59fce39b3f37631b4107aea80..39c6f1bff17ceb17cc4b74405971a51dba584d7b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -922,6 +922,7 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c + ${MAC_DIR}/ff-mac.c ${MAC_DIR}/minifapi.c ) diff --git a/openair2/LAYER2/MAC/ff-mac-callback.h b/openair2/LAYER2/MAC/ff-mac-callback.h index 5eadf92baa3f694f171c55691ed877fac6d8b383..bac156419fec76b1959b104b461919d038eb2fca 100644 --- a/openair2/LAYER2/MAC/ff-mac-callback.h +++ b/openair2/LAYER2/MAC/ff-mac-callback.h @@ -4,16 +4,16 @@ /* these are the callback function types from the scheduler to openair */ /* sched */ -typedef void (SchedDlConfigInd_callback)(void *callback_data, const struct SchedDlConfigIndParameters *params); -typedef void (SchedUlConfigInd_callback)(void *callback_data, const struct SchedUlConfigIndParameters *params); +typedef void (SchedDlConfigInd_callback_t)(void *callback_data, const struct SchedDlConfigIndParameters *params); +typedef void (SchedUlConfigInd_callback_t)(void *callback_data, const struct SchedUlConfigIndParameters *params); /* csched */ -typedef void (CschedCellConfigCnf_callback)(void *callback_data, const struct CschedCellConfigCnfParameters *params); -typedef void (CschedUeConfigCnf_callback)(void *callback_data, const struct CschedUeConfigCnfParameters *params); -typedef void (CschedLcConfigCnf_callback)(void *callback_data, const struct CschedLcConfigCnfParameters *params); -typedef void (CschedLcReleaseCnf_callback)(void *callback_data, const struct CschedLcReleaseCnfParameters *params); -typedef void (CschedUeReleaseCnf_callback)(void *callback_data, const struct CschedUeReleaseCnfParameters *params); -typedef void (CschedUeConfigUpdateInd_callback)(void *callback_data, const struct CschedUeConfigUpdateIndParameters *params); -typedef void (CschedCellConfigUpdateInd_callback)(void *callback_data, const struct CschedCellConfigUpdateIndParameters *params); +typedef void (CschedCellConfigCnf_callback_t)(void *callback_data, const struct CschedCellConfigCnfParameters *params); +typedef void (CschedUeConfigCnf_callback_t)(void *callback_data, const struct CschedUeConfigCnfParameters *params); +typedef void (CschedLcConfigCnf_callback_t)(void *callback_data, const struct CschedLcConfigCnfParameters *params); +typedef void (CschedLcReleaseCnf_callback_t)(void *callback_data, const struct CschedLcReleaseCnfParameters *params); +typedef void (CschedUeReleaseCnf_callback_t)(void *callback_data, const struct CschedUeReleaseCnfParameters *params); +typedef void (CschedUeConfigUpdateInd_callback_t)(void *callback_data, const struct CschedUeConfigUpdateIndParameters *params); +typedef void (CschedCellConfigUpdateInd_callback_t)(void *callback_data, const struct CschedCellConfigUpdateIndParameters *params); #endif /* FF_MAC_CALLBACK_H */ diff --git a/openair2/LAYER2/MAC/ff-mac-init.h b/openair2/LAYER2/MAC/ff-mac-init.h index 762eab3e2b667489237c6bef46034c6d7aee4240..ba7dd211084ebaa41609b27429c08dea869ce4b1 100644 --- a/openair2/LAYER2/MAC/ff-mac-init.h +++ b/openair2/LAYER2/MAC/ff-mac-init.h @@ -9,16 +9,16 @@ extern "C" { /* this function is called to create and initialize a scheduler */ void *SchedInit( - void *callback_data, - SchedDlConfigInd_callback *SchedDlConfigInd, - SchedUlConfigInd_callback *SchedUlConfigInd, - CschedCellConfigCnf_callback *CschedCellConfigCnf, - CschedUeConfigCnf_callback *CschedUeConfigCnf, - CschedLcConfigCnf_callback *CschedLcConfigCnf, - CschedLcReleaseCnf_callback *CschedLcReleaseCnf, - CschedUeReleaseCnf_callback *CschedUeReleaseCnf, - CschedUeConfigUpdateInd_callback *CschedUeConfigUpdateInd, - CschedCellConfigUpdateInd_callback *CschedCellConfigUpdateInd); + void *callback_data, + SchedDlConfigInd_callback_t *SchedDlConfigInd, + SchedUlConfigInd_callback_t *SchedUlConfigInd, + CschedCellConfigCnf_callback_t *CschedCellConfigCnf, + CschedUeConfigCnf_callback_t *CschedUeConfigCnf, + CschedLcConfigCnf_callback_t *CschedLcConfigCnf, + CschedLcReleaseCnf_callback_t *CschedLcReleaseCnf, + CschedUeReleaseCnf_callback_t *CschedUeReleaseCnf, + CschedUeConfigUpdateInd_callback_t *CschedUeConfigUpdateInd, + CschedCellConfigUpdateInd_callback_t *CschedCellConfigUpdateInd); #if defined (__cplusplus) } diff --git a/openair2/LAYER2/MAC/ff-mac.c b/openair2/LAYER2/MAC/ff-mac.c new file mode 100644 index 0000000000000000000000000000000000000000..1dedf8cbb4641199a56074feac90f818eda565da --- /dev/null +++ b/openair2/LAYER2/MAC/ff-mac.c @@ -0,0 +1,79 @@ +#include "ff-mac.h" +#include "ff-mac-sched-sap.h" +#include "ff-mac-csched-sap.h" +#include "ff-mac-init.h" +#include "log.h" + +#include <stdlib.h> + +/* this structure stores required data for OAI to work with FAPI */ +/* it is the private version of fapi_interface_t */ +struct fapi { + fapi_interface_t fi; /* the start of the structure matches fapi_interface_t */ +}; + +/* here come the callbacks */ +void SchedDlConfigInd_callback(void *callback_data, const struct SchedDlConfigIndParameters *params) +{ +} + +void SchedUlConfigInd_callback(void *callback_data, const struct SchedUlConfigIndParameters *params) +{ +} + +void CschedCellConfigCnf_callback(void *callback_data, const struct CschedCellConfigCnfParameters *params) +{ +} + +void CschedUeConfigCnf_callback(void *callback_data, const struct CschedUeConfigCnfParameters *params) +{ +} + +void CschedLcConfigCnf_callback(void *callback_data, const struct CschedLcConfigCnfParameters *params) +{ +} + +void CschedLcReleaseCnf_callback(void *callback_data, const struct CschedLcReleaseCnfParameters *params) +{ +} + +void CschedUeReleaseCnf_callback(void *callback_data, const struct CschedUeReleaseCnfParameters *params) +{ +} + +void CschedUeConfigUpdateInd_callback(void *callback_data, const struct CschedUeConfigUpdateIndParameters *params) +{ +} + +void CschedCellConfigUpdateInd_callback(void *callback_data, const struct CschedCellConfigUpdateIndParameters *params) +{ +} + +fapi_interface_t *init_fapi(void) +{ + struct fapi *ret; + + LOG_I(MAC, "FAPI initialization\n"); + + ret = calloc(1, sizeof(struct fapi)); + if (ret == NULL) LOG_E(MAC, "init_fapi: memory allocation error\n"); + + ret->fi.sched = SchedInit(ret, + SchedDlConfigInd_callback, + SchedUlConfigInd_callback, + CschedCellConfigCnf_callback, + CschedUeConfigCnf_callback, + CschedLcConfigCnf_callback, + CschedLcReleaseCnf_callback, + CschedUeReleaseCnf_callback, + CschedUeConfigUpdateInd_callback, + CschedCellConfigUpdateInd_callback); + + if (ret->fi.sched == NULL) { + LOG_E(MAC, "init_fapi: SchedInit failed\n"); + free(ret); + return NULL; + } + + return (fapi_interface_t *)ret; +} diff --git a/openair2/LAYER2/MAC/ff-mac.h b/openair2/LAYER2/MAC/ff-mac.h new file mode 100644 index 0000000000000000000000000000000000000000..d3caabd856d102ddab938a36c84e220e4c6fa3d5 --- /dev/null +++ b/openair2/LAYER2/MAC/ff-mac.h @@ -0,0 +1,17 @@ +#ifndef FF_MAC_H +#define FF_MAC_H + +/* this file contains OAI related FAPI definitions */ + +/* this is the public view of the FAPI's OAI interface */ +typedef struct { + void *sched; /* this is the pointer returned by SchedInit */ + /* to be used when calling FAPI functions */ +} fapi_interface_t; + +/* this function initializes OAI's FAPI interfacing + * it returns the opaque pointer given by SchedInit + */ +fapi_interface_t *init_fapi(void); + +#endif /* FF_MAC_H */ diff --git a/openair2/LAYER2/MAC/minifapi.c b/openair2/LAYER2/MAC/minifapi.c index 04490208363dc187ffcd2c18ff25b89803a64089..6a9d307d55511e981ff9e9bb71e0ef5c34914453 100644 --- a/openair2/LAYER2/MAC/minifapi.c +++ b/openair2/LAYER2/MAC/minifapi.c @@ -12,29 +12,29 @@ #include <stdio.h> struct scheduler { - void *callback_data; - SchedDlConfigInd_callback *SchedDlConfigInd; - SchedUlConfigInd_callback *SchedUlConfigInd; - CschedCellConfigCnf_callback *CschedCellConfigCnf; - CschedUeConfigCnf_callback *CschedUeConfigCnf; - CschedLcConfigCnf_callback *CschedLcConfigCnf; - CschedLcReleaseCnf_callback *CschedLcReleaseCnf; - CschedUeReleaseCnf_callback *CschedUeReleaseCnf; - CschedUeConfigUpdateInd_callback *CschedUeConfigUpdateInd; - CschedCellConfigUpdateInd_callback *CschedCellConfigUpdateInd; + void *callback_data; + SchedDlConfigInd_callback_t *SchedDlConfigInd; + SchedUlConfigInd_callback_t *SchedUlConfigInd; + CschedCellConfigCnf_callback_t *CschedCellConfigCnf; + CschedUeConfigCnf_callback_t *CschedUeConfigCnf; + CschedLcConfigCnf_callback_t *CschedLcConfigCnf; + CschedLcReleaseCnf_callback_t *CschedLcReleaseCnf; + CschedUeReleaseCnf_callback_t *CschedUeReleaseCnf; + CschedUeConfigUpdateInd_callback_t *CschedUeConfigUpdateInd; + CschedCellConfigUpdateInd_callback_t *CschedCellConfigUpdateInd; }; void *SchedInit( - void *callback_data, - SchedDlConfigInd_callback *SchedDlConfigInd, - SchedUlConfigInd_callback *SchedUlConfigInd, - CschedCellConfigCnf_callback *CschedCellConfigCnf, - CschedUeConfigCnf_callback *CschedUeConfigCnf, - CschedLcConfigCnf_callback *CschedLcConfigCnf, - CschedLcReleaseCnf_callback *CschedLcReleaseCnf, - CschedUeReleaseCnf_callback *CschedUeReleaseCnf, - CschedUeConfigUpdateInd_callback *CschedUeConfigUpdateInd, - CschedCellConfigUpdateInd_callback *CschedCellConfigUpdateInd) + void *callback_data, + SchedDlConfigInd_callback_t *SchedDlConfigInd, + SchedUlConfigInd_callback_t *SchedUlConfigInd, + CschedCellConfigCnf_callback_t *CschedCellConfigCnf, + CschedUeConfigCnf_callback_t *CschedUeConfigCnf, + CschedLcConfigCnf_callback_t *CschedLcConfigCnf, + CschedLcReleaseCnf_callback_t *CschedLcReleaseCnf, + CschedUeReleaseCnf_callback_t *CschedUeReleaseCnf, + CschedUeConfigUpdateInd_callback_t *CschedUeConfigUpdateInd, + CschedCellConfigUpdateInd_callback_t *CschedCellConfigUpdateInd) { struct scheduler *ret; @@ -52,7 +52,7 @@ void *SchedInit( ret->CschedCellConfigCnf = CschedCellConfigCnf; ret->CschedUeConfigCnf = CschedUeConfigCnf; ret->CschedLcConfigCnf = CschedLcConfigCnf; - ret-> CschedLcReleaseCnf = CschedLcReleaseCnf; + ret->CschedLcReleaseCnf = CschedLcReleaseCnf; ret->CschedUeReleaseCnf = CschedUeReleaseCnf; ret->CschedUeConfigUpdateInd = CschedUeConfigUpdateInd; ret->CschedCellConfigUpdateInd = CschedCellConfigUpdateInd;