Skip to content
Snippets Groups Projects
Select Git revision
  • 1eafbcd544a46ccce06d2a3662d4ffc4f1aa22e8
  • master default protected
  • esap-gui-auth
  • esap-gui-dev
4 results

Main.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    fpga.cpp 70.11 KiB
    /* *************************************************************************
    * Copyright 2020
    * ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
    * P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    * *********************************************************************** */
    
    /* *************************************************************************
    * Author:
    * . Leon Hiemstra
    * . Pieter Donker
    * Purpose:
    * . opc-ua to ucp translator
    * Description:
    * . class for fpga registers (peripherals) that need some more actions
    * *********************************************************************** */
    
    #ifndef _REENTRANT
    #error ACK! You need to compile with _REENTRANT defined since this uses threads
    #endif
    
    #include <string>
    #include <cstdint>
    #include <algorithm>
    #include <cstdlib>
    #include <cmath>
    
    #include <stdexcept>
    #include <iostream>
    #include <iomanip>
    #include <exception>
    #include <unistd.h>
    
    #include <sys/time.h>
    #include <arpa/inet.h> // htons, inet_pton
    
    #include "fpga.h"
    #include "../tools/mmap.h"
    #include "../tools/util.h"
    
    #include<fstream>
    
    using namespace std;
    
    extern int debug;
    
    #define R_MEM 0  // read mem value
    #define R_UCP 1  // read value from hardware
    
    Periph_fpga::Periph_fpga(string ipaddr, string expected_design_name, uint expected_firmware_version, bool enabled):
        Enabled(enabled),
        my_expected_design_name(expected_design_name),
        my_expected_firmware_version(expected_firmware_version),
        my_current_design_name("-"),
        my_current_status("offline"),
        my_current_hw_version(0),
        my_current_fw_version("-.-"),
        my_bsn_input_sync_timeout(false),
        my_bsn_input_bsn(0),