Skip to content

Commit

Permalink
Merge pull request #2 from jaycedowell/caltech-bifrost-dsp
Browse files Browse the repository at this point in the history
COR packet format updates
  • Loading branch information
jack-h authored Mar 31, 2022
2 parents 8c0699f + 787464e commit 474d870
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/formats/cor.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, The Bifrost Authors. All rights reserved.
* Copyright (c) 2019-2021, The Bifrost Authors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -62,6 +62,7 @@ class CORDecoder : virtual public PacketDecoder {
const cor_hdr_type* pkt_hdr = (cor_hdr_type*)pkt_ptr;
const uint8_t* pkt_pld = pkt_ptr + sizeof(cor_hdr_type);
int pld_size = pkt_size - sizeof(cor_hdr_type);
uint8_t nchan_decim = (be32toh(pkt_hdr->frame_count_word) >> 16) & 0xFF;
uint8_t nserver = (be32toh(pkt_hdr->frame_count_word) >> 8) & 0xFF;
uint8_t server = be32toh(pkt_hdr->frame_count_word) & 0xFF;
uint16_t nchan_pkt = (pld_size/(8*4));
Expand All @@ -71,12 +72,12 @@ class CORDecoder : virtual public PacketDecoder {
pkt->sync = pkt_hdr->sync_word;
pkt->time_tag = be64toh(pkt_hdr->time_tag);
pkt->decimation = be32toh(pkt_hdr->navg);
pkt->seq = pkt->time_tag / 196000000 / (pkt->decimation / 100);
pkt->seq = pkt->time_tag / pkt->decimation;
pkt->nsrc = _nsrc;
pkt->src = (stand0*(2*(nstand-1)+1-stand0)/2 + stand1 + 1 - _src0)*nserver \
+ (server - 1);
pkt->chan0 = be16toh(pkt_hdr->first_chan) \
- nchan_pkt * (server - 1);
- nchan_decim*nchan_pkt * (server - 1);
pkt->nchan = nchan_pkt;
pkt->tuning = (nserver << 8) | (server - 1); // Stores the number of servers and
// the server that sent this packet
Expand Down

0 comments on commit 474d870

Please sign in to comment.