areaDetector  3-12-1
EPICS areaDetector framework
Macros | Enumerations | Functions | Variables
udp_client_pixirad_single.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <string.h>
#include "PIXIEII_data_utilities.h"
#include <math.h>
#include <osiSock.h>
#include <epicsMessageQueue.h>
#include <epicsThread.h>

Macros

#define DATA_BUFFLEN_BYTES   2048
 
#define HEADER_BUFFLEN_BYTES   32
 
#define BUFLEN   (DATA_BUFFLEN_BYTES+HEADER_BUFFLEN_BYTES)
 
#define MAX_PACK_LEN   1448
 
#define PACKET_TAG_BYTES   2
 
#define PACKET_TAG_OFFSET   0
 
#define PACKET_ID_BYTES   2
 
#define PACKET_ID_OFFSET   2
 
#define PACKET_CRC_BYTES   4
 
#define PACKET_SENSOR_DATA_OFFSET   (PACKET_TAG_BYTES+PACKET_ID_BYTES)
 
#define PACKET_EXTRA_BYTES   (PACKET_ID_BYTES+PACKET_TAG_BYTES+PACKET_CRC_BYTES)
 
#define PACKET_SENSOR_DATA_BYTES   (MAX_PACK_LEN-PACKET_EXTRA_BYTES)
 
#define PIXIEII_MODULES   1
 
#define FRAME_HAS_ALIGN_ERRORS   0x20
 
#define REG_PACKET   0x80
 
#define SLOT_ID_MASK   0xff
 
#define SLOT_ID_OFFSET   1
 
#define AUTOCAL_DATA   0x40
 
#define AUTOCAL_REG_DEPTH   5
 
#define COUNTER_REG_DEPTH   15
 
#define DUMMY_0_OFFSET   0
 
#define PIXIE_THDAC_MASK   0x1f
 
#define PIXIE_THDAC_OFFSET   0
 
#define DUMMY_1_OFFSET   8
 
#define LOOP_MODE_OFFSET   0
 
#define LOOP_MODE_MASK   0xff
 
#define LOOP_COLOR_MODE_OFFSET   0
 
#define LOOP_COLOR_MODE_MASK   0xf
 
#define LOOP_DTF_MODE_OFFSET   4
 
#define LOOP_DTF_MODE_MASK   0xf
 
#define MAX_STRLEN   200
 
#define MAX_PENDING_BUFFERS   1500
 
#define DEFAULT_NPACK   360
 
#define AUTOCAL_NPACK   135
 
#define DAQ_PACK_FRAGM   45
 
#define PORTA   2223
 
#define MOD_UDP_REMOTE_PORT   3333
 
#define PORTB   2224
 
#define MAXBUF   256217728
 
#define BYTES_PER_ROWS   16
 
#define DOUT_1   0x0001
 
#define DOUT_2   0x0002
 
#define DOUT_3   0x0004
 
#define DOUT_4   0x0008
 
#define DOUT_5   0x0010
 
#define DOUT_6   0x0020
 
#define DOUT_7   0x0040
 
#define DOUT_8   0x0080
 
#define DOUT_9   0x0100
 
#define DOUT_10   0x0200
 
#define DOUT_11   0x0400
 
#define DOUT_12   000800
 
#define DOUT_13   0x1000
 
#define DOUT_14   0x2000
 
#define DOUT_15   0x4000
 
#define DOUT_16   0x8000
 
#define HEADER_LENGHT   10
 
#define vt_dac   22
 
#define sh_code   33
 
#define shutter_duration_ms   44
 

Enumerations

enum  id_mode { FRAG_ID, NOFRAG_ID }
 
enum  moderation_type { UDPMOD, NOUDPMOD }
 

Functions

void print_packet (const unsigned char *buffer, unsigned int packet_len_bytes)
 
void key_proc (void *received_packet)
 
int convert_bit_stream_to_counts (int code_depth, unsigned short *source_memory_offset, unsigned short *destination_memory_offset, int reusulting_readings)
 
void my_bytes_swap (unsigned short *us_ptr)
 
void * module_data_parser_thread (void *arg)
 
int main (int argc, char **argv)
 

Variables

unsigned char * buf
 
unsigned char * process_buf
 
unsigned char looping =1
 
unsigned char * uchar_ptr
 
unsigned int crc_generator =0x2608edb
 
unsigned int calculated_crc32_byme
 
unsigned int calculated_crc32
 
unsigned int packet_index =0
 
unsigned int testword
 
int convert_data =1
 
unsigned int received_packets =0
 
unsigned int error_packets =0
 
unsigned int id_error_packets =0
 
int verbose =0
 
epicsMessageQueueId ptr_list
 

Macro Definition Documentation

◆ AUTOCAL_DATA

#define AUTOCAL_DATA   0x40

◆ AUTOCAL_NPACK

#define AUTOCAL_NPACK   135

◆ AUTOCAL_REG_DEPTH

#define AUTOCAL_REG_DEPTH   5

◆ BUFLEN

◆ BYTES_PER_ROWS

#define BYTES_PER_ROWS   16

◆ COUNTER_REG_DEPTH

#define COUNTER_REG_DEPTH   15

◆ DAQ_PACK_FRAGM

#define DAQ_PACK_FRAGM   45

◆ DATA_BUFFLEN_BYTES

#define DATA_BUFFLEN_BYTES   2048

◆ DEFAULT_NPACK

#define DEFAULT_NPACK   360

◆ DOUT_1

#define DOUT_1   0x0001

◆ DOUT_10

#define DOUT_10   0x0200

◆ DOUT_11

#define DOUT_11   0x0400

◆ DOUT_12

#define DOUT_12   000800

◆ DOUT_13

#define DOUT_13   0x1000

◆ DOUT_14

#define DOUT_14   0x2000

◆ DOUT_15

#define DOUT_15   0x4000

◆ DOUT_16

#define DOUT_16   0x8000

◆ DOUT_2

#define DOUT_2   0x0002

◆ DOUT_3

#define DOUT_3   0x0004

◆ DOUT_4

#define DOUT_4   0x0008

◆ DOUT_5

#define DOUT_5   0x0010

◆ DOUT_6

#define DOUT_6   0x0020

◆ DOUT_7

#define DOUT_7   0x0040

◆ DOUT_8

#define DOUT_8   0x0080

◆ DOUT_9

#define DOUT_9   0x0100

◆ DUMMY_0_OFFSET

#define DUMMY_0_OFFSET   0

◆ DUMMY_1_OFFSET

#define DUMMY_1_OFFSET   8

◆ FRAME_HAS_ALIGN_ERRORS

#define FRAME_HAS_ALIGN_ERRORS   0x20

◆ HEADER_BUFFLEN_BYTES

#define HEADER_BUFFLEN_BYTES   32

◆ HEADER_LENGHT

#define HEADER_LENGHT   10

◆ LOOP_COLOR_MODE_MASK

#define LOOP_COLOR_MODE_MASK   0xf

◆ LOOP_COLOR_MODE_OFFSET

#define LOOP_COLOR_MODE_OFFSET   0

◆ LOOP_DTF_MODE_MASK

#define LOOP_DTF_MODE_MASK   0xf

◆ LOOP_DTF_MODE_OFFSET

#define LOOP_DTF_MODE_OFFSET   4

◆ LOOP_MODE_MASK

#define LOOP_MODE_MASK   0xff

◆ LOOP_MODE_OFFSET

#define LOOP_MODE_OFFSET   0

◆ MAX_PACK_LEN

#define MAX_PACK_LEN   1448

◆ MAX_PENDING_BUFFERS

#define MAX_PENDING_BUFFERS   1500

◆ MAX_STRLEN

#define MAX_STRLEN   200

◆ MAXBUF

#define MAXBUF   256217728

◆ MOD_UDP_REMOTE_PORT

#define MOD_UDP_REMOTE_PORT   3333

◆ PACKET_CRC_BYTES

#define PACKET_CRC_BYTES   4

◆ PACKET_EXTRA_BYTES

#define PACKET_EXTRA_BYTES   (PACKET_ID_BYTES+PACKET_TAG_BYTES+PACKET_CRC_BYTES)

◆ PACKET_ID_BYTES

#define PACKET_ID_BYTES   2

◆ PACKET_ID_OFFSET

#define PACKET_ID_OFFSET   2

◆ PACKET_SENSOR_DATA_BYTES

#define PACKET_SENSOR_DATA_BYTES   (MAX_PACK_LEN-PACKET_EXTRA_BYTES)

◆ PACKET_SENSOR_DATA_OFFSET

#define PACKET_SENSOR_DATA_OFFSET   (PACKET_TAG_BYTES+PACKET_ID_BYTES)

◆ PACKET_TAG_BYTES

#define PACKET_TAG_BYTES   2

◆ PACKET_TAG_OFFSET

#define PACKET_TAG_OFFSET   0

◆ PIXIE_THDAC_MASK

#define PIXIE_THDAC_MASK   0x1f

◆ PIXIE_THDAC_OFFSET

#define PIXIE_THDAC_OFFSET   0

◆ PIXIEII_MODULES

#define PIXIEII_MODULES   1

◆ PORTA

#define PORTA   2223

◆ PORTB

#define PORTB   2224

◆ REG_PACKET

#define REG_PACKET   0x80

◆ sh_code

#define sh_code   33

◆ shutter_duration_ms

#define shutter_duration_ms   44

◆ SLOT_ID_MASK

#define SLOT_ID_MASK   0xff

◆ SLOT_ID_OFFSET

#define SLOT_ID_OFFSET   1

◆ vt_dac

#define vt_dac   22

Enumeration Type Documentation

◆ id_mode

enum id_mode
Enumerator
FRAG_ID 
NOFRAG_ID 

◆ moderation_type

Enumerator
UDPMOD 
NOUDPMOD 

Function Documentation

◆ convert_bit_stream_to_counts()

int convert_bit_stream_to_counts ( int  code_depth,
unsigned short *  source_memory_offset,
unsigned short *  destination_memory_offset,
int  reusulting_readings 
)

◆ key_proc()

void key_proc ( void *  received_packet)

◆ main()

int main ( int  argc,
char **  argv 
)

◆ module_data_parser_thread()

void* module_data_parser_thread ( void *  arg)

◆ my_bytes_swap()

void my_bytes_swap ( unsigned short *  us_ptr)

◆ print_packet()

void print_packet ( const unsigned char *  buffer,
unsigned int  packet_len_bytes 
)

Variable Documentation

◆ buf

unsigned char* buf

◆ calculated_crc32

unsigned int calculated_crc32

◆ calculated_crc32_byme

unsigned int calculated_crc32_byme

◆ convert_data

int convert_data =1

◆ crc_generator

unsigned int crc_generator =0x2608edb

◆ error_packets

unsigned int error_packets =0

◆ id_error_packets

unsigned int id_error_packets =0

◆ looping

unsigned char looping =1

◆ packet_index

unsigned int packet_index =0

◆ process_buf

unsigned char * process_buf

◆ ptr_list

epicsMessageQueueId ptr_list

◆ received_packets

unsigned int received_packets =0

◆ testword

unsigned int testword

◆ uchar_ptr

unsigned char* uchar_ptr

◆ verbose

int verbose =0