Psyllid
v1.12.4
Project 8 Data Acquisisition Software
|
#include <roach_packet.hh>
Public Attributes | |
uint32_t | f_unix_time |
uint32_t | f_pkt_in_batch:20 |
uint32_t | f_digital_id:6 |
uint32_t | f_if_id:6 |
uint32_t | f_user_data_1 |
uint32_t | f_user_data_0 |
uint64_t | f_reserved_0 |
uint64_t | f_reserved_1:63 |
uint8_t | f_freq_not_time:1 |
int8_t | f_data [8192] |
The UDP packets have this structure: #define PAYLOAD_SIZE 8192 // 1KB #define PACKET_SIZE sizeof(packet_t) typedef struct packet {
first 64bit word uint32_t unix_time; uint32_t pkt_in_batch:20; uint32_t digital_id:6; uint32_t if_id:6; second 64bit word uint32_t user_data_1; uint32_t user_data_0; third 64bit word uint64_t reserved_0; fourth 64bit word uint64_t reserved_1:63; uint64_t freq_not_time:1; payload char data[PAYLOAD_SIZE]; } packet_t;
The fields are:
32 bytes header + 8192 bytes payload = 8224 bytes in total. (Note network interfaces should be setup to handle MTU of this size - for high-speed network interfaces the default is usually much smaller. In any case, I've done this for the computer we acquired to go with the roach.)
Note that you may need to do some byte-reordering depending on the machine you're working with. Each 64-bit word inside the packet is sent as big-endian, whereas the machine attached to the roach uses little-endian. So I had to do this (quick-and-dirty fix that I used for testing, there may be more elegant solutions):
typedef struct raw_packet { uint64_t _h0; uint64_t _h1; uint64_t _h2; uint64_t _h3; ... } raw_packet_t;
packet_t *ntoh_packet(raw_packet_t *pkt) { pkt->_h0 = be64toh(pkt->_h0); pkt->_h1 = be64toh(pkt->_h1); pkt->_h2 = be64toh(pkt->_h2); pkt->_h3 = be64toh(pkt->_h3); ... return (packet_t *)pkt; }
Now, interpreting the data: There are two kinds of packets: time-domain and frequency-domain. Frequency domain:
Definition at line 107 of file roach_packet.hh.
int8_t f_data[ 8192] |
Definition at line 123 of file roach_packet.hh.
uint32_t f_digital_id |
Definition at line 112 of file roach_packet.hh.
uint8_t f_freq_not_time |
Definition at line 121 of file roach_packet.hh.
uint32_t f_if_id |
Definition at line 113 of file roach_packet.hh.
uint32_t f_pkt_in_batch |
Definition at line 111 of file roach_packet.hh.
uint64_t f_reserved_0 |
Definition at line 118 of file roach_packet.hh.
uint64_t f_reserved_1 |
Definition at line 120 of file roach_packet.hh.
uint32_t f_unix_time |
Definition at line 110 of file roach_packet.hh.
uint32_t f_user_data_0 |
Definition at line 116 of file roach_packet.hh.
uint32_t f_user_data_1 |
Definition at line 115 of file roach_packet.hh.