areaDetector  2-6
Macros | Functions | Variables
medipix_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 medipix 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

#define CMDLEN   4
#define DATAHEADERLEN   252
#define HEADER_LEN   15
#define MAXDATA   256*256*2*2
#define MAXLINE   256

Simple TCP server to simulate a medipix Labview system.

Arguments: port number - port number to listen for connections

Matthew Pearson Oct 2011

Giles Knap Jan 2012

#define MPX_PROFILE_LEN   256 * 8
#define MPX_SUM_LEN   4

Function Documentation

void * commandThread ( void *  command_fd)
void * dataThread ( void *  data_fd)
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)

void endian_swap ( uint64_t *  x)
int main ( int  argc,
char *  argv[] 
)
int produce_data ( int  socket_fd)

Produce simulation data when we start acquisition.

void sig_chld ( int  signo)

Signal handler for SIGCHLD.

NOT NEEDED NOW WE ARE USING PTHREADS.

Variable Documentation

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