areaDetector  3-14
EPICS areaDetector framework
Macros | Functions | Variables
merlin_sim.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
#include <stdint.h>
#include <time.h>

Macros

#define MAXLINE   256
 Simple TCP server to simulate a merlin Labview system. More...
 
#define MAXDATA   256*256*2*2
 
#define DATAHEADERLEN   252
 
#define MPX_PROFILE_LEN   256 * 8
 
#define MPX_SUM_LEN   4
 
#define CMDLEN   4
 
#define HEADER_LEN   15
 

Functions

void sig_chld (int signo)
 Signal handler for SIGCHLD. More...
 
int echo_request (int socket_fd)
 Read from socket and send back response. More...
 
int produce_data (int data_fd)
 Produce simulation data when we start acquisition. More...
 
void * commandThread (void *command_fd)
 
void * dataThread (void *data_fd)
 
int main (int argc, char *argv[])
 
void endian_swap (uint64_t *x)
 

Variables

int frame_count = 0
 
int frames_to_send = 0
 
int incrementer = 0
 
int data_exit = 0
 
int do_data = 0
 
pthread_mutex_t do_data_mutex = PTHREAD_MUTEX_INITIALIZER
 
pthread_cond_t do_data_cond = PTHREAD_COND_INITIALIZER
 
int Depth = 12
 

Macro Definition Documentation

◆ CMDLEN

#define CMDLEN   4

◆ DATAHEADERLEN

#define DATAHEADERLEN   252

◆ HEADER_LEN

#define HEADER_LEN   15

◆ MAXDATA

#define MAXDATA   256*256*2*2

◆ MAXLINE

#define MAXLINE   256

Simple TCP server to simulate a merlin Labview system.

Arguments: port number - port number to listen for connections

Matthew Pearson Oct 2011

Giles Knap Jan 2012

◆ MPX_PROFILE_LEN

#define MPX_PROFILE_LEN   256 * 8

◆ MPX_SUM_LEN

#define MPX_SUM_LEN   4

Function Documentation

◆ commandThread()

void * commandThread ( void *  command_fd)

◆ dataThread()

void * dataThread ( void *  data_fd)

◆ echo_request()

int echo_request ( int  socket_fd)

Read from socket and send back response.

Read a maximum of MAXLINE, or until a newline, then echo the command back.

Read until end of current block (header or body)

◆ endian_swap()

void endian_swap ( uint64_t *  x)

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ produce_data()

int produce_data ( int  socket_fd)

Produce simulation data when we start acquisition.

◆ sig_chld()

void sig_chld ( int  signo)

Signal handler for SIGCHLD.

NOT NEEDED NOW WE ARE USING PTHREADS.

Variable Documentation

◆ data_exit

int data_exit = 0

◆ Depth

int Depth = 12

◆ do_data

int do_data = 0

◆ do_data_cond

pthread_cond_t do_data_cond = PTHREAD_COND_INITIALIZER

◆ do_data_mutex

pthread_mutex_t do_data_mutex = PTHREAD_MUTEX_INITIALIZER

◆ frame_count

int frame_count = 0

◆ frames_to_send

int frames_to_send = 0

◆ incrementer

int incrementer = 0