benetel: driver for Benetel's 4G and 5G RRUs
This commit contains work done by Eurecom and by Benetel.
This commit is contained in:
@@ -179,8 +179,8 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
|
||||
*(cfgoptions[i].u64ptr) = (uint64_t)llu;
|
||||
printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) );
|
||||
} else {
|
||||
*(cfgoptions[i].iptr) = llu;
|
||||
printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) );
|
||||
*(cfgoptions[i].i64ptr) = llu;
|
||||
printf_params("[LIBCONFIG] %s: %lld\n", cfgpath,(long long)(*(cfgoptions[i].i64ptr)) );
|
||||
}
|
||||
} else {
|
||||
defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
|
||||
|
||||
@@ -518,7 +518,29 @@ const char* eurecomFunctionsNames[] = {
|
||||
"wakeup_txfh",
|
||||
"gNB_thread_rxtx0",
|
||||
"gNB_thread_rxtx1",
|
||||
"ru_thread_tx_wait"
|
||||
"ru_thread_tx_wait",
|
||||
"gNB_ulsch_decoding",
|
||||
"gNB_pdsch_codeword_scrambling",
|
||||
"gNB_dlsch_encoding",
|
||||
"gNB_pdsch_modulation",
|
||||
"gNB_pdcch_tx",
|
||||
"phy_procedures_gNB_tx",
|
||||
"phy_procedures_gNB_common_tx",
|
||||
"phy_procedures_gNB_uespec_rx",
|
||||
"nr_rx_pusch",
|
||||
"nr_ulsch_procedures_rx",
|
||||
"macxface_gNB_dlsch_ulsch_scheduler",
|
||||
|
||||
/*NR ue-softmodem signal*/
|
||||
"nr_ue_ulsch_encoding",
|
||||
"nr_segmentation",
|
||||
"ldpc_encoder_optim",
|
||||
"nr_rate_matching_ldpc",
|
||||
"nr_interleaving_ldpc",
|
||||
"pss_synchro_nr",
|
||||
"pss_search_time_nr",
|
||||
"nr_initial_ue_sync",
|
||||
"beam_switching_gpio"
|
||||
};
|
||||
|
||||
struct vcd_module_s vcd_modules[] = {
|
||||
|
||||
@@ -511,6 +511,29 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_RU_TX_WAIT,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_CODEWORD_SCRAMBLING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PDSCH_MODULATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,
|
||||
|
||||
/* NR ue-softmodem signal*/
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_LDPC_ENCODER_OPTIM,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INTERLEAVING_LDPC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SYNCHRO_NR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_PSS_SEARCH_TIME_NR,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHING_GPIO,
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_END
|
||||
} vcd_signal_dump_functions;
|
||||
|
||||
@@ -73,7 +73,7 @@ typedef struct {
|
||||
} T_cache_t;
|
||||
|
||||
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_FUNCTIONS (249)
|
||||
#define VCD_NUM_FUNCTIONS (269)
|
||||
|
||||
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
|
||||
#define VCD_NUM_VARIABLES (187)
|
||||
|
||||
@@ -3393,3 +3393,106 @@ ID = VCD_FUNCTION_RU_TX_WAIT
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ru_thread_tx_wait
|
||||
ID = VCD_FUNCTION_PHY_gNB_ULSCH_DECODING
|
||||
DESC = VCD function PHY_gNB_ULSCH_DECODING
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = gNB_ulsch_decoding
|
||||
ID = VCD_FUNCTION_gNB_PDSCH_CODEWORD_SCRAMBLING
|
||||
DESC = VCD function gNB_PDSCH_CODEWORD_SCRAMBLING
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = gNB_pdsch_codeword_scrambling
|
||||
ID = VCD_FUNCTION_gNB_DLSCH_ENCODING
|
||||
DESC = VCD function gNB_DLSCH_ENCODING
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = gNB_dlsch_encoding
|
||||
ID = VCD_FUNCTION_gNB_PDSCH_MODULATION
|
||||
DESC = VCD function gNB_PDSCH_MODULATION
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = gNB_pdsch_modulation
|
||||
ID = VCD_FUNCTION_PHY_gNB_PDCCH_TX
|
||||
DESC = VCD function PHY_gNB_PDCCH_TX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = gNB_pdcch_tx
|
||||
ID = VCD_FUNCTION_PHY_PROCEDURES_gNB_TX
|
||||
DESC = VCD function PHY_PROCEDURES_gNB_TX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = phy_procedures_gNB_tx
|
||||
ID = VCD_FUNCTION_PHY_PROCEDURES_gNB_COMMON_TX
|
||||
DESC = VCD function PHY_PROCEDURES_gNB_COMMON_TX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = phy_procedures_gNB_common_tx
|
||||
ID = VCD_FUNCTION_PHY_PROCEDURES_gNB_UESPEC_RX
|
||||
DESC = VCD function PHY_PROCEDURES_gNB_UESPEC_RX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = phy_procedures_gNB_uespec_rx
|
||||
ID = VCD_FUNCTION_NR_RX_PUSCH
|
||||
DESC = VCD function NR_RX_PUSCH
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_rx_pusch
|
||||
ID = VCD_FUNCTION_NR_ULSCH_PROCEDURES_RX
|
||||
DESC = VCD function NR_ULSCH_PROCEDURES_RX
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_ulsch_procedures_rx
|
||||
ID = VCD_FUNCTION_gNB_DLSCH_ULSCH_SCHEDULER
|
||||
DESC = VCD function gNB_DLSCH_ULSCH_SCHEDULER
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = macxface_gNB_dlsch_ulsch_scheduler
|
||||
|
||||
#function for nrUE
|
||||
ID = VCD_FUNCTION_NR_UE_ULSCH_ENCODING
|
||||
DESC = VCD function NR_UE_ULSCH_ENCODING
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_ue_ulsch_encoding
|
||||
ID = VCD_FUNCTION_NR_SEGMENTATION
|
||||
DESC = VCD function NR_SEGMENTATION
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_segmentation
|
||||
ID = VCD_FUNCTION_LDPC_ENCODER_OPTIM
|
||||
DESC = VCD function LDPC_ENCODER_OPTIM
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = ldpc_encoder_optim
|
||||
ID = VCD_FUNCTION_NR_RATE_MATCHING_LDPC
|
||||
DESC = VCD function NR_RATE_MATCHING_LDPC
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_rate_matching_ldpc
|
||||
ID = VCD_FUNCTION_NR_INTERLEAVING_LDPC
|
||||
DESC = VCD function NR_INTERLEAVING_LDPC
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_interleaving_ldpc
|
||||
ID = VCD_FUNCTION_PSS_SYNCHRO_NR
|
||||
DESC = VCD function PSS_SYNCHRO_NR
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = pss_synchro_nr
|
||||
ID = VCD_FUNCTION_PSS_SEARCH_TIME_NR
|
||||
DESC = VCD function PSS_SEARCH_TIME_NR
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = pss_search_time_nr
|
||||
ID = VCD_FUNCTION_NR_INITIAL_UE_SYNC
|
||||
DESC = VCD function NR_INITIAL_UE_SYNC
|
||||
GROUP = ALL:VCD:UE:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = nr_initial_ue_sync
|
||||
ID = VCD_FUNCTION_BEAM_SWITCHING_GPIO
|
||||
DESC = VCD function BEAM_SWITCHING_GPIO
|
||||
GROUP = ALL:VCD:ENB:VCD_FUNCTION
|
||||
FORMAT = int,value
|
||||
VCD_NAME = beam_switching_gpio
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
|
||||
else return(N_RB-1-tmp2);
|
||||
}
|
||||
|
||||
/* TS 38.214 ch. 6.1.2.2.2 - Resource allocation type 1 for DL and UL */
|
||||
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
|
||||
AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
|
||||
|
||||
@@ -62,14 +63,21 @@ int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
|
||||
int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) {
|
||||
return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275));
|
||||
}
|
||||
|
||||
/// Target code rate tables indexed by Imcs
|
||||
/* TS 38.214 table 5.1.3.1-1 - MCS index table 1 for PDSCH */
|
||||
uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \
|
||||
616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948};
|
||||
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
|
||||
|
||||
/* TS 38.214 table 5.1.3.1-2 - MCS index table 2 for PDSCH */
|
||||
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
|
||||
uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \
|
||||
616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948};
|
||||
|
||||
/* TS 38.214 table 5.1.3.1-3 - MCS index table 3 for PDSCH */
|
||||
uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \
|
||||
378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772};
|
||||
|
||||
uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
|
||||
336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
|
||||
1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \
|
||||
|
||||
@@ -80,7 +80,7 @@ task_list_t tasks[TASK_MAX];
|
||||
|
||||
void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size) {
|
||||
void *ptr = NULL;
|
||||
AssertFatal ((ptr=malloc (size)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
|
||||
AssertFatal ((ptr=calloc (size, 1)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
|
||||
size, origin_task_id, destination_task_id);
|
||||
return ptr;
|
||||
}
|
||||
@@ -91,8 +91,16 @@ task_list_t tasks[TASK_MAX];
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// in the two following functions, the +32 in malloc is there to deal with gcc memory alignment
|
||||
// because a struct size can be larger than sum(sizeof(struct components))
|
||||
// We should remove the itti principle of a huge union for all types of messages in paramter "msg_t ittiMsg"
|
||||
// to use a more C classical pointer casting "void * ittiMsg", later casted in the right struct
|
||||
// but we would have to change all legacy macros, as per this example
|
||||
// #define S1AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_req
|
||||
// would become
|
||||
// #define S1AP_REGISTER_ENB_REQ(mSGpTR) (s1ap_register_enb_req) mSGpTR)->ittiMsg
|
||||
MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size) {
|
||||
MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, sizeof(MessageHeader) + size);
|
||||
MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, sizeof(MessageHeader) +32 + size);
|
||||
temp->ittiMsgHeader.messageId = message_id;
|
||||
temp->ittiMsgHeader.originTaskId = origin_task_id;
|
||||
temp->ittiMsgHeader.ittiMsgSize = size;
|
||||
@@ -100,7 +108,7 @@ task_list_t tasks[TASK_MAX];
|
||||
}
|
||||
|
||||
MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) {
|
||||
int size=sizeof(MessageHeader) + messages_info[message_id].size;
|
||||
int size=sizeof(MessageHeader) + 32 + messages_info[message_id].size;
|
||||
MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, size);
|
||||
temp->ittiMsgHeader.messageId = message_id;
|
||||
temp->ittiMsgHeader.originTaskId = origin_task_id;
|
||||
|
||||
@@ -256,6 +256,7 @@ typedef struct IttiMsgText_s {
|
||||
//#include <proto.h>
|
||||
|
||||
#include <openair3/GTPV1-U/gtpv1u_eNB_task.h>
|
||||
#include <openair3/GTPV1-U/gtpv1u_gNB_task.h>
|
||||
void *rrc_enb_process_itti_msg(void *);
|
||||
#include <openair3/SCTP/sctp_eNB_task.h>
|
||||
#include <openair3/S1AP/s1ap_eNB.h>
|
||||
@@ -414,7 +415,7 @@ static const message_info_t messages_info[] = {
|
||||
#undef MESSAGE_DEF
|
||||
};
|
||||
|
||||
typedef struct __attribute__ ((__packed__)) MessageDef_s {
|
||||
typedef struct MessageDef_s {
|
||||
MessageHeader ittiMsgHeader; /**< Message header */
|
||||
msg_t ittiMsg;
|
||||
} MessageDef;
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <sys/resource.h>
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include <readline/history.h>
|
||||
|
||||
@@ -507,12 +508,22 @@ int process_command(char *buf) {
|
||||
}
|
||||
|
||||
rt= CMDSTATUS_FOUND;
|
||||
} else if (strncasecmp(cmd,"get",3) == 0 || strncasecmp(cmd,"set",3) == 0) {
|
||||
} else if (strcasecmp(cmd,"get") == 0 || strcasecmp(cmd,"set") == 0) {
|
||||
rt= setgetvar(i,cmd[0],cmdb);
|
||||
} else {
|
||||
for (k=0 ; telnetparams.CmdParsers[i].cmd[k].cmdfunc != NULL ; k++) {
|
||||
if (strncasecmp(cmd, telnetparams.CmdParsers[i].cmd[k].cmdname,sizeof(telnetparams.CmdParsers[i].cmd[k].cmdname)) == 0) {
|
||||
telnetparams.CmdParsers[i].cmd[k].cmdfunc(cmdb, telnetparams.telnetdbg, client_printf);
|
||||
if (telnetparams.CmdParsers[i].cmd[k].qptr != NULL) {
|
||||
notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(telnetsrv_qmsg_t),0,NULL,NULL);
|
||||
telnetsrv_qmsg_t *cmddata=NotifiedFifoData(msg);
|
||||
cmddata->cmdfunc=(qcmdfunc_t)telnetparams.CmdParsers[i].cmd[k].cmdfunc;
|
||||
cmddata->prnt=client_printf;
|
||||
cmddata->debug=telnetparams.telnetdbg;
|
||||
cmddata->cmdbuff=strdup(cmdb);
|
||||
pushNotifiedFIFO(telnetparams.CmdParsers[i].cmd[k].qptr, msg);
|
||||
} else {
|
||||
telnetparams.CmdParsers[i].cmd[k].cmdfunc(cmdb, telnetparams.telnetdbg, client_printf);
|
||||
}
|
||||
rt= CMDSTATUS_FOUND;
|
||||
}
|
||||
} /* for k */
|
||||
@@ -673,6 +684,16 @@ void run_telnetsrv(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
void poll_telnetcmdq(void *qid, void *arg) {
|
||||
notifiedFIFO_elt_t *msg = pollNotifiedFIFO((notifiedFIFO_t *)qid);
|
||||
|
||||
if (msg != NULL) {
|
||||
telnetsrv_qmsg_t *msgdata=NotifiedFifoData(msg);
|
||||
msgdata->cmdfunc(msgdata->cmdbuff,msgdata->debug,msgdata->prnt,arg);
|
||||
free(msgdata->cmdbuff);
|
||||
delNotifiedFIFO_elt(msg);
|
||||
}
|
||||
}
|
||||
/*------------------------------------------------------------------------------------------------*/
|
||||
/* load the commands delivered with the telnet server
|
||||
*
|
||||
@@ -758,6 +779,7 @@ int telnetsrv_autoinit(void) {
|
||||
*/
|
||||
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd) {
|
||||
int i;
|
||||
notifiedFIFO_t *afifo=NULL;
|
||||
|
||||
if( modulename == NULL || var == NULL || cmd == NULL) {
|
||||
fprintf(stderr,"[TELNETSRV] Telnet server, add_telnetcmd: invalid parameters\n");
|
||||
@@ -769,6 +791,13 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
|
||||
strncpy(telnetparams.CmdParsers[i].module,modulename,sizeof(telnetparams.CmdParsers[i].module)-1);
|
||||
telnetparams.CmdParsers[i].cmd = cmd;
|
||||
telnetparams.CmdParsers[i].var = var;
|
||||
if (cmd->cmdflags & TELNETSRV_CMDFLAG_PUSHINTPOOLQ) {
|
||||
if (afifo == NULL) {
|
||||
afifo = malloc(sizeof(notifiedFIFO_t));
|
||||
initNotifiedFIFO(afifo);
|
||||
}
|
||||
cmd->qptr = afifo;
|
||||
}
|
||||
printf("[TELNETSRV] Telnet server: module %i = %s added to shell\n",
|
||||
i,telnetparams.CmdParsers[i].module);
|
||||
break;
|
||||
@@ -797,8 +826,10 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
|
||||
}
|
||||
|
||||
int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
|
||||
*farray=malloc(sizeof(loader_shlibfunc_t));
|
||||
*farray=malloc(sizeof(loader_shlibfunc_t)*2);
|
||||
(*farray)[0].fname=TELNET_ADDCMD_FNAME;
|
||||
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
|
||||
return 1;
|
||||
(*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
|
||||
(*farray)[1].fptr=(int (*)(void) )poll_telnetcmdq;
|
||||
return ( 2);
|
||||
}
|
||||
|
||||
@@ -53,13 +53,26 @@
|
||||
/* to add a set of new command to the telnet server shell */
|
||||
typedef void(*telnet_printfunc_t)(const char* format, ...);
|
||||
typedef int(*cmdfunc_t)(char*, int, telnet_printfunc_t prnt);
|
||||
typedef int(*qcmdfunc_t)(char*, int, telnet_printfunc_t prnt,void *arg);
|
||||
|
||||
#define TELNETSRV_CMDFLAG_PUSHINTPOOLQ (1<<0) // ask the telnet server to push the command in a thread pool queue
|
||||
typedef struct cmddef {
|
||||
char cmdname[TELNET_CMD_MAXSIZE];
|
||||
char helpstr[TELNET_HELPSTR_SIZE];
|
||||
cmdfunc_t cmdfunc;
|
||||
unsigned int cmdflags;
|
||||
void *qptr;
|
||||
} telnetshell_cmddef_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* structure used to send a command via a message queue to enable */
|
||||
/* executing a command in a thread different from the telnet server thread */
|
||||
typedef struct telnetsrv_qmsg {
|
||||
qcmdfunc_t cmdfunc;
|
||||
telnet_printfunc_t prnt;
|
||||
int debug;
|
||||
char *cmdbuff;
|
||||
} telnetsrv_qmsg_t;
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*structure to be used when adding a module to the telnet server */
|
||||
/* This is the first parameter of the add_telnetcmd function, which can be used */
|
||||
@@ -111,9 +124,6 @@ typedef struct {
|
||||
} telnetsrv_params_t;
|
||||
|
||||
|
||||
|
||||
typedef int(*addcmdfunc_t)(char*, telnetshell_vardef_t*, telnetshell_cmddef_t*);
|
||||
|
||||
typedef void(*settelnetmodule_t)(char *name, void *ptr);
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
@@ -133,7 +143,9 @@ VT escape sequence definition, for smarter display....
|
||||
|
||||
/*---------------------------------------------------------------------------------------------*/
|
||||
#define TELNET_ADDCMD_FNAME "add_telnetcmd"
|
||||
#define TELNET_POLLCMDQ_FNAME "poll_telnetcmdq"
|
||||
typedef int(*add_telnetcmd_func_t)(char *, telnetshell_vardef_t *, telnetshell_cmddef_t *);
|
||||
typedef void(*poll_telnetcmdq_func_t)(void *qid,void *arg);
|
||||
#ifdef TELNETSERVERCODE
|
||||
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd);
|
||||
void set_sched(pthread_t tid, int pid,int priority);
|
||||
|
||||
@@ -111,9 +111,10 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
||||
pool->activated=true;
|
||||
initNotifiedFIFO(&pool->incomingFifo);
|
||||
char *saveptr, * curptr;
|
||||
char *parms_cpy=strdup(params);
|
||||
pool->nbThreads=0;
|
||||
pool->restrictRNTI=false;
|
||||
curptr=strtok_r(params,",",&saveptr);
|
||||
curptr=strtok_r(parms_cpy,",",&saveptr);
|
||||
struct one_thread * ptr;
|
||||
while ( curptr!=NULL ) {
|
||||
int c=toupper(curptr[0]);
|
||||
@@ -145,7 +146,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
|
||||
|
||||
curptr=strtok_r(NULL,",",&saveptr);
|
||||
}
|
||||
|
||||
free(parms_cpy);
|
||||
if (pool->activated && pool->nbThreads==0) {
|
||||
printf("No servers created in the thread pool, exit\n");
|
||||
exit(1);
|
||||
|
||||
@@ -105,3 +105,9 @@ char *itoa(int i) {
|
||||
return strdup(buffer);
|
||||
}
|
||||
|
||||
void *memcpy1(void *dst,const void *src,size_t n) {
|
||||
|
||||
void *ret=dst;
|
||||
asm volatile("rep movsb" : "+D" (dst) : "c"(n), "S"(src) : "cc","memory");
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ int hex_char_to_hex_value (char c);
|
||||
// Converts an hexadecimal ASCII coded string into its value.**
|
||||
int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size);
|
||||
|
||||
void *memcpy1(void *dst,const void *src,size_t n);
|
||||
|
||||
|
||||
char *itoa(int i);
|
||||
|
||||
#define findInList(keY, result, list, element_type) {\
|
||||
|
||||
Reference in New Issue
Block a user