2015-11-06 06:57:03 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
2015-11-06 17:45:43 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/wait.h>
|
2015-12-03 02:38:17 +08:00
|
|
|
#include <sys/prctl.h>
|
2015-11-06 06:57:03 +08:00
|
|
|
|
|
|
|
typedef struct client_s
|
|
|
|
{
|
|
|
|
struct sockaddr_in addr;
|
|
|
|
int socket;
|
|
|
|
pid_t pid;
|
|
|
|
int pipefd[2];
|
2015-11-06 17:45:43 +08:00
|
|
|
int error;
|
2015-12-02 21:51:20 +08:00
|
|
|
pid_t dsp_proc;
|
2015-11-06 06:57:03 +08:00
|
|
|
} client_t;
|
|
|
|
|
|
|
|
|
2015-11-04 20:31:47 +08:00
|
|
|
void client();
|
2015-11-06 06:57:03 +08:00
|
|
|
void error_exit(const char* why);
|
2015-12-02 21:51:20 +08:00
|
|
|
void print_exit(const char* why);
|
2015-11-06 06:57:03 +08:00
|
|
|
void print_client(client_t* client, const char* what);
|
2015-11-06 21:14:02 +08:00
|
|
|
int proc_exists(pid_t pid);
|
2015-12-02 22:27:28 +08:00
|
|
|
pid_t run_subprocess(char* cmd, int* pipe_in, int* pipe_out);
|
2015-12-02 21:51:20 +08:00
|
|
|
void maxfd(int* maxfd, int fd);
|
2015-12-03 02:38:17 +08:00
|
|
|
void sig_handler(int signo);
|
2015-12-02 21:51:20 +08:00
|
|
|
|
|
|
|
typedef enum ddc_method_e
|
|
|
|
{
|
|
|
|
M_TD,
|
|
|
|
M_FASTDDC
|
|
|
|
} ddc_method_t;
|
|
|
|
|
|
|
|
const char subprocess_cmd_td[] = "csdr "
|
|
|
|
#ifdef NEON_OPTS
|
|
|
|
"shift_addfast_cc"
|
|
|
|
#else
|
|
|
|
"shift_unroll_cc"
|
|
|
|
#endif
|
2015-12-03 05:40:20 +08:00
|
|
|
" --pipe %d | csdr fir_decimate_cc %d %g";
|
2015-12-02 21:51:20 +08:00
|
|
|
|
2015-12-03 02:38:17 +08:00
|
|
|
const char subprocess_args_fastddc_1[] = "csdr through %d %g";
|
|
|
|
//const char subprocess_args_fastddc_1[] = "csdr fastddc_fwd_cc %d %g";
|
2015-12-03 05:40:20 +08:00
|
|
|
//const char subprocess_args_fastddc_2[] = "csdr fastddc_inv_cc %d --pipe %d %g";
|
|
|
|
const char subprocess_args_fastddc_2[] = "csdr convert_u8_f %d %d %g";
|