mirror of
https://github.com/n5ac/smartsdr-dsp.git
synced 2026-04-05 22:35:29 +00:00
Add '--console' command line parameter to enable console thread. Replaces previous IFDEF
This commit is contained in:
parent
d7a84b9ded
commit
a05e965db2
4 changed files with 31 additions and 18 deletions
|
|
@ -49,9 +49,8 @@
|
|||
|
||||
static uint32 _api_version;
|
||||
static uint32 _handle;
|
||||
#ifdef CONSOLE_THREAD
|
||||
static pthread_t _console_thread_ID;
|
||||
#endif
|
||||
|
||||
static BOOL console_thread_abort = FALSE;
|
||||
#define PROMPT "\n\033[92mWaveform -->\033[33m"
|
||||
static sem_t _startup_sem, _communications_sem;
|
||||
|
|
@ -94,10 +93,10 @@ void SmartSDR_API_Shutdown(void)
|
|||
void* _console_thread(void* param)
|
||||
{
|
||||
cmd_banner();
|
||||
output(PROMPT);
|
||||
// let everybody know we're through printing
|
||||
sem_post(&_startup_sem);
|
||||
sem_wait(&_communications_sem);
|
||||
output(PROMPT);
|
||||
while (!console_thread_abort)
|
||||
{
|
||||
command();
|
||||
|
|
@ -108,7 +107,7 @@ void* _console_thread(void* param)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void SmartSDR_API_Init(void)
|
||||
void SmartSDR_API_Init(BOOL enable_console)
|
||||
{
|
||||
sem_init(&_startup_sem,0,0);
|
||||
sem_init(&_communications_sem,0,0);
|
||||
|
|
@ -116,20 +115,22 @@ void SmartSDR_API_Init(void)
|
|||
// initialize printed output
|
||||
lock_printf_init();
|
||||
lock_malloc_init();
|
||||
/* Initialize UDP connections for TX */
|
||||
vita_output_Init();
|
||||
sched_waveform_Init();
|
||||
|
||||
// Start the console thread
|
||||
#ifdef CONSOLE_THREAD
|
||||
pthread_create(&_console_thread_ID, NULL, &_console_thread, NULL);
|
||||
#endif
|
||||
|
||||
if ( enable_console ) {
|
||||
pthread_create(&_console_thread_ID, NULL, &_console_thread, NULL);
|
||||
// wait for the console to print out all it's stuff
|
||||
sem_wait(&_startup_sem);
|
||||
// initialize the traffic cop
|
||||
tc_Init();
|
||||
sem_wait(&_startup_sem);
|
||||
}
|
||||
|
||||
// initialize the discovery client
|
||||
dc_Init();
|
||||
|
||||
/* Initialize Traffic Cop for TCP RX/TX */
|
||||
tc_Init();
|
||||
}
|
||||
|
||||
/* *****************************************************************************
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ uint32 api_getVersion(void);
|
|||
void api_setHandle(uint32 handle);
|
||||
uint32 api_getHandle(void);
|
||||
void SmartSDR_API_Shutdown(void);
|
||||
void SmartSDR_API_Init(void);
|
||||
void SmartSDR_API_Init(BOOL enable_console);
|
||||
uint32 register_mode(void);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ void tc_Abort(void);
|
|||
void tc_startKeepalive(void);
|
||||
void tc_abort(void);
|
||||
void tc_Init(void);
|
||||
void SmartSDR_API_Init(void);
|
||||
uint32 tc_sendSmartSDRcommand(char* command, BOOL block, char** response);
|
||||
Command tc_commandList_respond(uint32 sequence, char* response);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue