mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-11-11 03:43:52 +01:00
Build and Deploy on local RHEL9 / build (push) Successful in 2m0s
Build on RHEL9 docker image / build (push) Successful in 5m0s
Build and Deploy on local RHEL8 / build (push) Successful in 5m10s
Build on RHEL8 docker image / build (push) Successful in 5m27s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m41s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m6s
* replaced bf specific usleep replacement with one using cycle counts to be stable while changing optimization levels * uint32_t signature on usleep since the register read is 32bit... * enabled -O2 for ctb and mythen + a few additional warnings * configure stack size for blackfin servers to 256kB instead of the default 4kB * enable opt for JF and Moench, ratemax make local for eiger * fixed misplaced volatile on Beb_Read32 * removed dead code in eiger server (which had 2 byte read passt end), usleep_bf returns -1 for sleeps that can't be represented * deal with fall through of table filling in ratecorr table * memory clobber for inline asm and added flags on eiger * -O2 for gotthard and xilinx * fixes to remove the new warnings * fixed new eiger warnings * binaries in --------- Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
134 lines
3.6 KiB
C
134 lines
3.6 KiB
C
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#pragma once
|
|
|
|
#include <inttypes.h>
|
|
#include <sys/types.h>
|
|
|
|
/** enable support for ARDY signal on interface to FPGA
|
|
* needed to properly translate avalon_mm_waitrequest in the CTB firmware
|
|
* https://www.analog.com/media/en/dsp-documentation/processor-manuals/bf537_hwr_Rev3.2.pdf
|
|
* page 274
|
|
* */
|
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST (0)
|
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK \
|
|
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST)
|
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST (1)
|
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK \
|
|
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST)
|
|
|
|
#define BFIN_AMC_ACCESS_EXTENSION_ENA_VAL \
|
|
(BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK | BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK)
|
|
#define BFIN_AMC_ACCESS_EXTENSION_FNAME \
|
|
"/sys/kernel/debug/blackfin/ebiu_amc/EBIU_AMBCTL1"
|
|
|
|
/**
|
|
* Write into a 16 bit register
|
|
* @param offset address offset
|
|
* @param data 16 bit data
|
|
*/
|
|
void bus_w16(u_int32_t offset, u_int16_t data);
|
|
|
|
/**
|
|
* Read from a 16 bit register
|
|
* @param offset address offset
|
|
* @retuns 16 bit data read
|
|
*/
|
|
u_int16_t bus_r16(u_int32_t offset);
|
|
|
|
/**
|
|
* Write into a 32 bit register
|
|
* @param offset address offset
|
|
* @param data 32 bit data
|
|
*/
|
|
void bus_w(u_int32_t offset, u_int32_t data);
|
|
|
|
/**
|
|
* Read from a 32 bit register
|
|
* @param offset address offset
|
|
* @retuns 32 bit data read
|
|
*/
|
|
u_int32_t bus_r(u_int32_t offset);
|
|
|
|
/**
|
|
* Read from a 64 bit register
|
|
* @param aLSB LSB offset address
|
|
* @param aMSB MSB offset address
|
|
* @returns 64 bit data read
|
|
*/
|
|
int64_t get64BitReg(int aLSB, int aMSB);
|
|
|
|
/**
|
|
* Write into a 64 bit register
|
|
* @param value 64 bit data
|
|
* @param aLSB LSB offset address
|
|
* @param aMSB MSB offset address
|
|
* @returns 64 bit data read
|
|
*/
|
|
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
|
|
|
/**
|
|
* Read unsigned 64 bit from a 64 bit register
|
|
* @param aLSB LSB offset address
|
|
* @param aMSB MSB offset address
|
|
* @returns unsigned 64 bit data read
|
|
*/
|
|
uint64_t getU64BitReg(int aLSB, int aMSB);
|
|
|
|
/**
|
|
* Write unsigned 64 bit into a 64 bit register
|
|
* @param value unsigned 64 bit data
|
|
* @param aLSB LSB offset address
|
|
* @param aMSB MSB offset address
|
|
*/
|
|
void setU64BitReg(uint64_t value, int aLSB, int aMSB);
|
|
|
|
/**
|
|
* Read from a 32 bit register (literal register value provided by client)
|
|
* @param offset address offset
|
|
* @retuns 32 bit data read
|
|
*/
|
|
u_int32_t readRegister(u_int32_t offset);
|
|
|
|
/**
|
|
* Write into a 32 bit register (literal register value provided by client)
|
|
* @param offset address offset
|
|
* @param data 32 bit data
|
|
*/
|
|
void writeRegister(u_int32_t offset, u_int32_t data);
|
|
|
|
/**
|
|
* Read from a 16 bit register (literal register value provided by client)
|
|
* @param offset address offset
|
|
* @retuns 16 bit data read
|
|
*/
|
|
u_int32_t readRegister16(u_int32_t offset);
|
|
|
|
/**
|
|
* Write into a 16 bit register (literal register value provided by client)
|
|
* @param offset address offset
|
|
* @param data 16 bit data
|
|
*/
|
|
void writeRegister16(u_int32_t offset, u_int32_t data);
|
|
|
|
/**
|
|
* Get base address for memory copy
|
|
*/
|
|
uint32_t *Blackfin_getBaseAddress();
|
|
/**
|
|
* Map FPGA
|
|
*/
|
|
int mapCSP0(void);
|
|
|
|
/**
|
|
* Prepare the core cycle counter used by usleep_bf (called from mapCSP0)
|
|
*/
|
|
int initCycleCounter(void);
|
|
|
|
/**
|
|
* busy-wait for usecs on the core cycle counter
|
|
* @returns 0, or -1 without sleeping if the wait does not fit the 32-bit
|
|
* cycle count (about 8 s at 525 MHz)
|
|
*/
|
|
int usleep_bf(uint32_t us);
|