Skip to content
Snippets Groups Projects
Select Git revision
  • d53bb5fb96c1c880f7d496a86f8a433a715e93e0
  • main default protected
  • pck_cnt
  • upgrade_yocto
  • dev
  • test_chtk
  • feat-xvc-legacy
7 results

fofb-init.sh

Blame
  • Romain BROUCQUART's avatar
    BRONES Romain authored
    * This python script browse a simple file to write register using python
      deviceaccess.
    2848acf2
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    fofb-init.sh 1.45 KiB
    #!/bin/bash
    
    . /etc/init.d/functions
    
    PATH_CONF="/opt/fofb/cfg/configuration"
    
    logger -t "fofb-fpgainit" "Reading configuration file ${PATH_CONF}"
    
    
    start() {
        if [ ! -f ${PATH_CONF} ]; then
            echo "Configuration file not found: ${PATH_CONF}"
            exit 1
        fi
    
        source ${PATH_CONF}
    
        case $FOFB_APP in
            cellnode|centralnode)
                echo "Found configuration ${FOFB_APP}"
                ;;
            *)
                echo "Could not establish FOFB application"
                exit 1
                ;;
        esac
    
        # Taking the last binary file in the sorted list (higher tag)
        PATH_FPGABIN=$(ls -S /lib/firmware/base/${FOFB_APP}/*.bin | tail -n 1)
        echo "Loading FPGA image ${PATH_FPGABIN}"
        fpgautil -b ${PATH_FPGABIN}
    
        # Reset the FPGA
        /etc/init.d/fw_plreset.sh
    
        # Linking the correct MAP file
        PATH_MAP="/opt/fofb/map/app_${FOFB_APP}.mapt"
        echo "Linking map file ${PATH_MAP}"
        ln -sf ${PATH_MAP} /opt/fofb/map/app.mapt
    
        # Applying configuration
        fofb-configurator --config /opt/fofb/cfg/config_register --dmap /opt/fofb/opcua-server/devices.dmap
    
    }
    
    stop() {
        echo "Nothing to be done"
    }
    
    
    
    ### main logic ###
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        status)
            echo "Cannot give any status"
            ;;
        restart|reload|condrestart)
            stop
            start
            ;;
        *)
            echo $"Usage: $0 {start|stop|restart|reload|status}"
            exit 1
    esac
    
    
    
    exit 0